{layout name="public/layout" /}
{include file='yxnavbar'}


<div class="main">
    <div class="panel panel-info">
        <div class="panel-heading">当前数量： {$total}</div>
        <div class="panel-body">
            <form id = "myform" action="./index.php" method="get" class="form-horizontal" role="form">
                <input type="hidden" name="c" value="site" />
                <input type="hidden" name="a" value="entry" />
                <input type="hidden" name="m" value="{$_P['m']}" />
                <input type="hidden" name="do" id="do" value="ad" />
                <input type="hidden" name="op"  value="ad_full_btn_list" />
                <input type="hidden" name="status" value="{$status}">
                <input type="hidden" name="pay_status" value="{$pay_status}">
                <input type="hidden" name="search_data" value="{$search_data}">

                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-1 control-label">状态</label>

                    {if $type_arr && is_array($type_arr)}
                    <div class="col-sm-9 col-lg-9 col-md-9 col-xs-9">
                        <div class="btn-group">
                            {loop $type_arr $row}
                            <a href="{php echo filter_url('type:'.$row['type']);}" class="btn {if $type == $row['type']}btn-primary{else}btn-default{/if}">{php echo $row['title'];}<span style="color: #ff0000">{php echo $row['total'];}</span></a>
                            {/loop}
                        </div>
                    </div>
                    {/if}
                    {if count($themelist)>1 }
                    <div class="col-xs-12 col-sm-2 col-md-2">
                        <select onchange="submitForm();" class="form-control" name="themeid">
                            {loop $themelist $row}
                            <option value="{$row['id']}" {if $themeid == $row['id'] }selected="selected"{/if}>{$row['id']} - {php echo mb_substr($row['title'],0,8,'utf-8');}</option>
                            {/loop}
                        </select>
                    </div>
                    {else}
                    <input type="hidden" name="themeid" value="{$themeid}" />
                    {/if}
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-1 control-label">展示条件</label>
                    {if $aduser_arr && is_array($aduser_arr)}
                    <div class="col-sm-9 col-lg-9 col-md-9 col-xs-9">
                        <div class="btn-group">
                            {loop $aduser_arr $row}
                            <a href="{php echo filter_url('aduser:'.$row['aduser']);}" class="btn {if $aduser == $row['aduser']}btn-primary{else}btn-default{/if}">{php echo $row['title'];}<span style="color: #ff0000">{php echo $row['total'];}</span></a>
                            {/loop}
                        </div>
                    </div>
                    {/if}
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-1 control-label">提交时间</label>
                    <div class="col-sm-3 col-lg-3 col-md-3 col-xs-3">
                        {php echo view_form_field_daterange('createtime', array('start'=>date('Y-m-d H:i:s',$starttime),'end'=>date('Y-m-d H:i:s',$endtime)), true);}
                    </div>

                </div>
                <div class="form-group clearfix">
                    <label class="col-xs-12 col-sm-3 col-md-1 control-label">关键字</label>
                    <div class="col-sm-3 col-xs-3 col-md-3">
                        <input class="form-control" name="search_data" placeholder="输入搜索内容" type="text" value="{$_P['search_data']}">
                    </div>
                    <div class="col-sm-3 col-lg-3 col-md-3 col-xs-6">
                        <button class="btn btn-primary"><i class="fa fa-search"></i> 搜索</button>
                        <input type="hidden" name="__token__" value="{$Request.token}"/>
                    </div>
<!--                    <div class="col-sm-2 col-lg-2 col-md-2 col-xs-2">-->
<!--                        <input class="btn btn-default" type="submit" name="export_submit" id="export_submit" value="导出记录EXCEL">-->
<!--                    </div>-->
                </div>
            </form>
        </div>
    </div>


    <div class="tab-content">
        <div class="panel panel-default">
            <div class="panel-body table-responsive">
                <table class="table table-hover">
                    <thead class="navbar-inner">
                    <tr>
                        <th style="width: 50px">UID</th>
                        <th style="width: 120px">头像昵称</th>
                        <th style="width: 100px">是否付款</th>
                        <th style="width: 120px">上级</th>
                        <th style="width: 120px">员工</th>
                        <th style="width: 120px">动作</th>
                        <th style="width: 120px">时间</th>

                        <th style="width: 120px;text-align: right">操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    {loop $list $index $item}
                    <tr>
                        <td>{$item['uid']}</td>
                        <td>
                            <img src="{php echo tomedia($item['avatar']);}" width="28" style="border-radius: 3px;"><br>
                            {$item['username']}<br>
                            {$item['mobile']}
                        </td>
                        <td>
                            {if !$item['has_order']}
                            <span class="label label-warning">未支付</span>
                            {else}
                            <span class="label label-success">已支付</span>
                            {/if}
                        </td>
                        <td>
                            <img src="{php echo tomedia($item['from_avatar']);}" width="28" style="border-radius: 3px;"><br>
                            {$item['from_username']}
                            <br>
                        </td>
                        <td>
                            <img src="{php echo tomedia($item['worker_avatar']);}" width="28" style="border-radius: 3px;"><br>
                            {$item['workername']}
                            <br>
                            {$item['teamname']}
                            <br>
                            {$item['companyname']}
                            <br>
                        </td>
                        <td>
                            {if !$item['type']}
                            <span class="label label-warning">点击取消或关闭</span>
                            {else}
                            <span class="label label-success">点击确认</span>
                            {/if}
                        </td>
                        <td>
                            {$item['created_at']}
                        </td>
                        <td style="text-align: right;">
                            <a  class="btn btn-danger btn-sm" onclick="deleteOp({$item['id']})"  title="删除" data-toggle="tooltip" data-placement="top"><i class="fa fa-times"></i></a>
                        </td>
                    </tr>
                    {/loop}
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    function submitForm(){
        let tmp_do = 'record';
        $("#do").val(tmp_do);
        var form = document.getElementById("myform");
        form.submit();
    }
    function deleteOp(id) {
        layer.confirm('确认删除此记录吗？',{
            btn:['确认','取消'],
            yes:function () {
                var post_url = "{php echo createWebUrl($do, array('op' => 'btm_click_del','themeid'=>$themeid));}";
                $.ajax({
                    url:post_url,
                    dataType:'json',
                    method:'post',
                    data:{id:id},
                    success:function (e) {
                        let status = e.status;
                        let result = e.result;
                        if (status!=1){
                            layer.msg(result.msg)
                        }else{
                            layer.msg(result.msg)
                            setTimeout(function () {
                                window.location.reload();
                            },1500);
                        }
                    }
                });
            }
        })
    }
</script>
{$pager}
